package com.jbob.collection;

public class Qrel 
{
	private String docName;
	private String path;
	private boolean pertinent;
	
	public Qrel(String line) 
	{
		String[] infos = line.split("\\p{Space}");
		docName = infos[0].substring(infos[0].lastIndexOf("/") + 1).trim();
		path = infos[1].substring(1).trim();
		pertinent = infos[2].equals("1");
	}

	@Override
	public String toString() 
	{
		return docName + " " + path + " " + pertinent;
	}
	
	public boolean isPertinent()
	{
		return pertinent;
	}
	
	public String getPath()
	{
		return path;
	}
	
	public String getDocName()
	{
		return docName;
	}
	
	@Override
	public boolean equals(Object obj) 
	{
		if(obj instanceof String)
		{
			return this.path.equals(obj);
		}
		
		if(obj instanceof Balise)
		{
			return this.path.equals(((Balise) obj).getPath());
		}
		
		return super.equals(obj);
	}
}
